<?php defined('IN_ADMIN') or exit('Access Denied!'); ?>
<?php
    @list($min_price, $max_price)   = explode(',', $data['price']);
    @list($min_person, $max_person) = explode(',', $data['person']);
    @list($min_table, $max_table)   = explode(',', $data['table']);

?>
<div class="subnav">
  <div class="content-menu ib-a blue line-x">
    <a><em>酒店信息</em></a> <span>|</span>
    <a class="on"><em>编辑酒店</em></a>
  </div>
</div>
<form action="/admin/hotel/save/<?=isset($data['shop_id'])?intval($data['shop_id']):'';?>" method="post" id="myform">
  <input type="hidden" name="method" value="<?=$method;?>" />
  <div class="pad-10">
    <div class="col-tab">
      <ul class="tabBut cu-li" id="tab_setting">
        <li id="tab_setting_1" class="on">酒店信息</li>
        <li id="tab_setting_2" class="off">详细介绍</li>
      </ul>
      <div id="div_setting_1" class="contentList pad-10">
        <table width="100%"  class="table_form">
          <tr>
            <th width="120">价格区间</th>
            <td class="y-bg">
                <input type="text" class="input-text" name="min_price" id="min_price" size="10" value="<?=i($min_price);?>"/> ～
                <input type="text" class="input-text" name="max_price" id="max_price" size="10" value="<?=i($max_price);?>"/> 元/桌</td>
          </tr>
          <tr>
            <th width="120">容纳人数</th>
            <td class="y-bg">
                <input type="text" class="input-text" name="min_person" id="min_person" size="10" value="<?=i($min_person);?>"/> ～
                <input type="text" class="input-text" name="max_person" id="max_person" size="10" value="<?=i($max_person);?>"/> 人</td>
          </tr>
          <tr>
            <th width="120">容纳桌数</th>
            <td class="y-bg">
                <input type="text" class="input-text" name="min_table" id="min_table" size="10" value="<?=i($min_table);?>"/> ～
                <input type="text" class="input-text" name="max_table" id="max_table" size="10" value="<?=i($max_table);?>"/> 桌</td>
          </tr>
          <tr>
            <th width="120">酒店类型</th>
            <td class="y-bg">
              <select name="tags[]">
                <option value="0">选择...</option>
            <!--?=View::options($cats, $data['cats']);?-->
            <?php
                foreach($cats as $key => $var){
                    $sel = (in_array($key, $data['tags']) ? ' selected' : '');
            ?>
                <option value="<?=$key;?>"<?=$sel;?>><?=h($var);?></option>
            <?php } ?>
              </select>
            </td>
          </tr>
          <tr>
            <th width="120">场地类型</th>
            <td class="y-bg">
            <?php
                foreach($tags as $key => $var){
                  $sel = (in_array($key, $data['tags']) ? ' checked' : '');
            ?>
                <label>
                    <input type="checkbox" name="tags[]" id="tag_<?=$key;?>" value="<?=$key;?>"<?=$sel;?> />
                    <?=h($var);?>
                </label>
            <?php } ?>
            </td>
          </tr>
        </table>
      </div>
      <div id="div_setting_2" class="contentList pad-10 hidden">
        <textarea name="description" id="description"><?=$data['description'];?></textarea>
        <script type="text/javascript" src="<?=ADMIN_STATIC_URL;?>js/ckeditor/ckeditor.js"></script>
        <script type="text/javascript">
        CKEDITOR.replace('description',
            {height:200,pages:false,subtitle:false,textareaid:'description',module:'',catid:'',
        flashupload:true,alowuploadexts:'',allowbrowser:'1',allowuploadnum:'10',authkey:'8fdc5fec4d43fae9f6565954fbd8862e',
        /*filebrowserUploadUrl : 'http://localhost/phpcms9/index.php?m=attachment&c=attachments&a=upload&module=&catid=&dosubmit=1',*/
        toolbar :
        [
        ['Source','-','Templates'],
                    ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'],
                    ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['ShowBlocks'],['Image','Capture','Flash'],['Maximize'],
                    '/',
                    ['Bold','Italic','Underline','Strike','-'],
                    ['Subscript','Superscript','-'],
                    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
                    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
                    ['Link','Unlink','Anchor'],
                    ['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
                    '/',
                    ['Styles','Format','Font','FontSize'],
                    ['TextColor','BGColor'],
                    ['attachment'],
        ]
        });
        </script>
      </div>
            <div class="bk15"></div>
      <input name="dosubmit" type="submit" value="提交" class="button">
    </div>
  </div>
</form>
<script type="text/javascript">
$(document).ready(function(){
    tabs('#tab_setting', 'setting');

    $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
    $("#name").formValidator({onshow:"请输入外卖名称",onfocus:"请输入外卖名称"}).inputValidator({min:1,onerror:"外卖名称没有填写"});
    $("#zone_id,#subzone_id").formValidator({onshow:"请选择区域/板块",onfocus:"请选择区域/板"}).functionValidator({
        fun:function(){
            return ($("#subzone_id").val() >0 && $("#zone_id").val() > 0);
        },
        onerror:"区域/板块没有选择"
    });
    $("#address").formValidator({onshow:"请输入外卖地址",onfocus:"请输入外卖地址"}).inputValidator({min:1,onerror:"外卖地址没有填写"});
    $("#topic").formValidator({onshow:"请输入外卖简介",onfocus:"请用一句话描述，100字以内"}).inputValidator({max:100,onerror:"简介内容至多100字"});
})

</script>
